package com.code.day03;

public class Demo02for {
    public static void main(String[] args) {
//        计算偶数之间的合他们之间的和
//        思路先将他们的数遍历出来，在判断出是否能被2整除在进行赋值
        int sum = 0;
        int sum2 = 0;
        int str = 0;
        int str2 = 0;
        for (int i = 0; i <= 100; i++) {
            if (i % 2 == 0) {
                sum += i;
            }
        }
        System.out.println(sum);

//         计算0到100之间的偶数有多少个

        for (int i = 0; i <= 100; i++) {
            if (i % 2 == 0) {
                str++;
                sum = i;
            } else {
                str2++;
                sum2 = i;
            }
        }
        System.out.println("第" + str + "次偶数" + sum);
        System.out.println("第" + str2 + "次奇数" + sum2);

    }


}
